const joi = require('joi');

// 登录接口参数校验
const loginPostSchema = joi.object({
  account: joi.string().min(11).max(11).pattern(/^1[23456789]\d{9}$/).required(),
  pwd: joi.string().min(6).max(18).pattern(/^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?\|]).*$/).required()
});


// 注册接口参数校验
const registerPostSchema = joi.object({
  account: joi.string().min(11).max(11).pattern(/^1[23456789]\d{9}$/).required(),
  pwd: joi.string().min(6).max(18).pattern(/^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?\|]).*$/).required(),
  username: joi.string().min(2).max(10).required(),
  photo: joi.string().empty(''),
  sex: joi.string().valid('男', '女', '进过宫', '去过泰国', '不想说').required()
});


module.exports = {
  loginPostSchema,
  registerPostSchema
}